package com.tuanzi.service.impl;

import com.tuanzi.dao.FlowerPotMapper;
import com.tuanzi.dao.TemperatureDayMapper;
import com.tuanzi.dao.TemperatureWeekMapper;
import com.tuanzi.entity.FlowerPot;
import com.tuanzi.entity.TemperatureDay;
import com.tuanzi.entity.TemperatureWeek;
import com.tuanzi.service.IndexService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author tuanzi
 * @version 1.0
 * @date 2022/3/31 18:10
 */

@Service
public class IndexServiceImpl implements IndexService {

    @Resource
    private FlowerPotMapper flowerPotMapper;

    @Resource
    private TemperatureDayMapper temperatureDayMapper;

    @Resource
    private TemperatureWeekMapper temperatureWeekMapper;

    /**
     * 获取用户所有的花盆
     */
    @Override
    public List<FlowerPot> getUserFlowerPots(Integer uid) {
        return flowerPotMapper.selectUserPots(uid);
    }

    /**
     * 获取花盆一天内的所有温度
     */
    @Override
    public List<TemperatureDay> getDayTemperature(Integer fid) {
        return temperatureDayMapper.selectTemperatureByFid(fid);
    }

    /**
     * 获取花盆一周内，每天的平均温度
     */
    @Override
    public List<TemperatureWeek> getWeekTemperature(Integer fid) {
        return temperatureWeekMapper.selectTemperatureByFid(fid);
    }


}
